/* 客服聊天容器 */
.customerChatContainer {
  display: flex;
  flex-direction: column;
  height:105%;
  max-width:91%;
  margin:15px 0 0 35px;
  background: #f5f5f5;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 聊天头部 */
.chatHeader {
  background: linear-gradient(135deg, #66ead2 0%, #4b86a2 100%);
  border: none;
  border-radius: 0;
  padding: 16px 20px;
}

.chatHeader :global(.ant-card-body) {
  padding: 0;
}

.headerAvatar {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.chatHeader :global(.ant-typography) {
  color: white !important;
}

.chatHeader :global(.ant-typography h5) {
  color: white !important;
  margin: 0;
}

.chatHeader :global(.ant-typography .ant-typography-secondary) {
  color: rgba(255, 255, 255, 0.8) !important;
}

/* 消息容器 */
.messagesContainer {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f8f9fa;
}

.messagesContainer::-webkit-scrollbar {
  width: 6px;
}

.messagesContainer::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.messagesContainer::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.messagesContainer::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 消息项 */
.messageItem {
  padding: 8px 0 !important;
  border: none !important;
}

.messageItem :global(.ant-list-item-meta) {
  align-items: flex-start;
}

/* 消息包装器 */
.messageWrapper {
  width: 100%;
  display: flex;
  margin-bottom: 8px;
}

/* 客户消息（右侧） */
.customerMessage {
  justify-content: flex-end;
}

.customerMessage .messageContent {
  max-width: 70%;
  text-align: right;
}

.customerMessage .messageBubble {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px 16px;
  border-radius: 18px 18px 4px 18px;
  margin-top: 4px;
  word-wrap: break-word;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.customerMessage .messageHeader {
  justify-content: flex-end;
  margin-bottom: 4px;
}

.customerMessage .senderName {
  order: 2;
  margin-left: 8px;
}

.customerMessage .timestamp {
  order: 1;
  margin-right: 8px;
}

.customerMessage .messageAvatar {
  order: 3;
  background: #667eea;
}

/* 客服消息（左侧） */
.serviceMessage {
  justify-content: flex-start;
}

.serviceMessage .messageContent {
  max-width: 70%;
  text-align: left;
}

.serviceMessage .messageBubble {
  background: white;
  color: #333;
  padding: 12px 16px;
  border-radius: 18px 18px 18px 4px;
  margin-top: 4px;
  word-wrap: break-word;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #e8e8e8;
}

.serviceMessage .messageHeader {
  justify-content: flex-start;
  margin-bottom: 4px;
}

.serviceMessage .senderName {
  order: 2;
  margin-left: 8px;
}

.serviceMessage .timestamp {
  order: 3;
  margin-left: 8px;
}

.serviceMessage .messageAvatar {
  order: 1;
  background: #52c41a;
}

/* 消息内容 */
.messageContent {
  display: flex;
  flex-direction: column;
}

.messageHeader {
  display: flex;
  align-items: center;
  font-size: 12px;
}

.senderName {
  font-weight: 500;
  color: #666;
}

.timestamp {
  font-size: 11px;
  color: #999;
}

.messageBubble {
  line-height: 1.5;
  font-size: 14px;
}

/* 快速回复容器 */
.quickRepliesContainer {
  padding: 16px 20px;
  background: white;
  border-top: 1px solid #e8e8e8;
}

.quickRepliesContainer :global(.ant-divider) {
  margin: 0 0 12px 0;
  font-size: 12px;
  color: #666;
}

.quickRepliesContainer :global(.ant-btn) {
  margin: 4px;
  border-radius: 16px;
  font-size: 12px;
  height: 28px;
  padding: 0 12px;
}

/* 输入容器 */
.inputContainer {
  background: white;
  border-top: 1px solid #e8e8e8;
  padding: 16px 20px;
}

.inputWrapper {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.messageInput {
  flex: 1;
  border-radius: 20px;
  resize: none;
  border: 1px solid #d9d9d9;
  padding: 8px 16px;
  font-size: 14px;
  line-height: 1.5;
  transition: all 0.3s;
}

.messageInput:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.sendButton {
  border-radius: 20px;
  height: 40px;
  padding: 0 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  font-weight: 500;
  transition: all 0.3s;
}

.sendButton:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.sendButton:disabled {
  background: #f5f5f5;
  color: #bfbfbf;
  transform: none;
  box-shadow: none;
}

.inputFooter {
  margin-top: 8px;
  text-align: center;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .customerChatContainer {
    height: 100vh;
    max-width: 100%;
    border-radius: 0;
  }
  
  .messagesContainer {
    padding: 16px;
  }
  
  .customerMessage .messageContent,
  .serviceMessage .messageContent {
    max-width: 85%;
  }
  
  .inputContainer {
    padding: 12px 16px;
  }
  
  .inputWrapper {
    gap: 8px;
  }
  
  .sendButton {
    padding: 0 16px;
    height: 36px;
  }

  /* 移动端表情选择器 */
  .emojiPicker {
    max-width: 280px;
    max-height: 250px;
    left: 50%;
    transform: translateX(-50%);
  }

  .emojiGrid {
    max-width: 240px;
  }

  .emojiButton {
    width: 35px;
    height: 35px;
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .chatHeader {
    padding: 12px 16px;
  }
  
  .messagesContainer {
    padding: 12px;
  }
  
  .customerMessage .messageContent,
  .serviceMessage .messageContent {
    max-width: 90%;
  }
  
  .messageBubble {
    padding: 10px 14px;
    font-size: 13px;
  }
  
  .quickRepliesContainer {
    padding: 12px 16px;
  }
  
  .quickRepliesContainer :global(.ant-btn) {
    font-size: 11px;
    height: 24px;
    padding: 0 8px;
  }
}

/* 动画效果 */
.messageItem {
  animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 在线状态指示器 */
.onlineIndicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #52c41a;
  margin-right: 8px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(82, 196, 26, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(82, 196, 26, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(82, 196, 26, 0);
  }
}

/* 语音相关样式 */
.voiceRecordButton {
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.voiceRecordButton:hover {
  transform: scale(1.1);
}

.voiceButton {
  margin-left: 8px;
  color: #1890ff;
  transition: all 0.3s;
}

.voiceButton:hover {
  color: #40a9ff;
  transform: scale(1.1);
}

/* 打字机光标动画 */
.typingCursor {
  animation: blink 1s infinite;
  color: #1890ff;
  font-weight: bold;
}

@keyframes blink {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
}

/* 语音录制动画 */
.recordingAnimation {
  position: relative;
}

.recordingAnimation::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border: 2px solid #ff4d4f;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: recordingPulse 1.5s infinite;
}

@keyframes recordingPulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0;
  }
}

/* 语音播放动画 */
.playingAnimation {
  animation: playingWave 1s infinite;
}

@keyframes playingWave {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

/* 表情选择器样式 */
.emojiPicker {
  position: absolute;
  bottom:90%;
  right: 0;
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 12px;
  margin-bottom: 8px;
  z-index: 1000;
  max-width: 320px;
  max-height: 300px;
  overflow-y: auto;
  animation: fadeInUp 0.2s ease-out;
}

.emojiGrid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-width: 280px;
}

.emojiButton {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  user-select: none;
}

.emojiButton:hover {
  background: #f5f5f5;
  transform: scale(1.1);
}

.emojiButton:active {
  transform: scale(0.95);
}

/* 表情按钮样式 */
.inputWrapper .emojiButton {
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.inputWrapper .emojiButton:hover {
  background: #f0f0f0;
  transform: scale(1.1);
}

/* 输入容器相对定位 */
.inputContainer {
  position: relative;
}

/* 流式输入样式 */
.streamingInput {
  border: 2px solid #1890ff;
  box-shadow: 0 0 10px rgba(24, 144, 255, 0.3);
}

/* 语音状态指示器 */
.voiceStatus {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

.voiceStatusIndicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #52c41a;
  animation: voicePulse 1s infinite;
}

@keyframes voicePulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

/* 音频消息样式 */
.audioMessage {
  display: flex;
  align-items: center;
  gap: 8px;
}

.audioPlayer {
  width: 200px;
  height: 32px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.audioPlayer::-webkit-media-controls-panel {
  background: rgba(255, 255, 255, 0.1);
}

.audioPlayer::-webkit-media-controls-play-button {
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
}

/* 客服消息中的音频播放器 */
.serviceMessage .audioPlayer {
  background: #f5f5f5;
  border: 1px solid #e8e8e8;
}

.serviceMessage .audioPlayer::-webkit-media-controls-panel {
  background: #f5f5f5;
}

.serviceMessage .audioPlayer::-webkit-media-controls-play-button {
  background: #1890ff;
  color: white;
}

/* 录音状态动画 */
.recordingStatus {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ff4d4f;
  font-size: 12px;
  margin-top: 4px;
}

.recordingDot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff4d4f;
  animation: recordingBlink 1s infinite;
}

@keyframes recordingBlink {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0.3;
  }
}

/* ==================== 图片相关样式 ==================== */

/* 图片按钮 */
.imageButton {
  background: #fff;
  border: 1px solid #d9d9d9;
  color: #666;
  transition: all 0.3s ease;
}

.imageButton:hover {
  background: #f0f0f0;
  border-color: #40a9ff;
  color: #40a9ff;
}

/* 图片消息 */
.imageMessage {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 8px 0;
}

.messageImage {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.messageImage:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 图片预览容器 */
.imagePreviewContainer {
  margin-top: 12px;
  padding: 12px;
  background: #f8f9fa;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
}

.imagePreviewHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e8e8e8;
}

.imagePreviewGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.imagePreviewItem {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.imagePreview {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.imagePreview:hover {
  transform: scale(1.1);
}

.removeImageButton {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  background: #ff4d4f;
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.imagePreviewItem:hover .removeImageButton {
  opacity: 1;
}

.removeImageButton:hover {
  background: #ff7875;
}

/* 响应式图片样式 */
@media (max-width: 768px) {
  .messageImage {
    max-width: 150px;
    max-height: 150px;
  }
  
  .imagePreviewGrid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  }
  
  .imagePreview {
    width: 60px;
    height: 60px;
  }
}

@media (max-width: 480px) {
  .messageImage {
    max-width: 120px;
    max-height: 120px;
  }
  
  .imagePreviewGrid {
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  }
  
  .imagePreview {
    width: 50px;
    height: 50px;
  }
}
